<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:rich="http://richfaces.org/rich">
<h:body>
    <ui:composition template="template.xhtml">
        <ui:define name="content">
            <br />
            <h:outputText value="#{msg.entry_creation_body_title}" styleClass="h1" />
            <br />
            <h:messages styleClass="h2" />
            <br />
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputText value="#{msg.entry_creation_form_name}" styleClass="h3" />
                    <h:inputText id="name" label="name" value="#{sessionBean.username}" disabled="true" />

                    <h:outputText value="#{msg.entry_creation_form_email}" styleClass="h3" />
                    <h:inputText id="email" label="email" required="true" size="40" requiredMessage="#{msg.entry_creation_form_email_required}" validatorMessage="#{msg.entry_creation_form_email_validation}"
                        value="#{actionsBean.entry.email}">
                        <f:validateRegex pattern="^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$" />
                    </h:inputText>
                    <h:outputText value="#{msg.entry_creation_form_title}" styleClass="h3" />
                    <h:inputText id="title" label="title" value="#{actionsBean.entry.title}" required="true" requiredMessage="#{msg.entry_creation_form_title_required}" />

                    <h:outputText value="#{msg.entry_creation_form_text}" styleClass="h3" />
                    <h:inputTextarea id="text" label="text" value="#{actionsBean.entry.text}" required="true" requiredMessage="#{msg.entry_creation_form_text_required}" />
                </h:panelGrid>
                <br />
                <h:commandButton action="#{actionsBean.createEntry}" value="#{msg.entry_creation_command}" />
                <h:button outcome="guestbookOverview" value="#{msg.back}" />
            </h:form>
        </ui:define>
    </ui:composition>
</h:body>
</html>
